Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse negative numbers in Norwegian (and 59 other languages) #290

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Mar 21, 2024

🤔 What's changed?

The DecimalFormatSymbols for Norwegian and 59 other languages use the minus-sign (unicode 8722) instead of the hyphen-minus sign (ascii 45).

While technically correct, Gherkin is written on regular keyboards and there is no practical way to write a minus-sign. By patching the DecimalFormatSymbols with a regular minus sign we solve this problem.

Additionally, for the same reason, the non-breaking space (ascii 160) and right single quotation mark (unicode 8217) for thousands separators are also patched with either a period or comma.

⚡️ What's your motivation?

Fixes: #287

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)
  • ⚡ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

I hope nobody was using the non-breaking spaces in their feature files.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

The DecimalFormatSymbols for Norwegian and 59 other languages use the
minus-sign (unicode 8722) instead of the hyphen-minus sign (ascii 45).

While technically correct, Gherkin is written on regular keyboards and
there is no practical way to write a minus-sign. By patching the
`DecimalFormatSymbols` with a regular minus sign we solve this problem.

Additionally, for the same reason, the non-breaking space (ascii 160)
and right single quotation mark (unicode 8217) for thousands separators
are also patched with either a period or colon.

Fixes: #287
@mpkorstanje mpkorstanje merged commit 3f535a2 into main Mar 21, 2024
28 checks passed
@mpkorstanje mpkorstanje deleted the use-writeable-number-formats branch March 21, 2024 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to parse negative number in Norwegian
1 participant